<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

session_start();

class Verify extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		
		
		
		$this->load->helper(array('url','cookie','html','language','security'));
		$this->load->library(array('parser','session','user_agent','email','encrypt'));
		
		
		$uagent = do_hash($this->agent->browser());
		$platform = do_hash($this->agent->platform());
		
		if($this->agent->is_browser())
		{
			if(($this->input->cookie('dsn_agent') != $uagent) OR ($this->input->cookie('dsn_platform') != $platform))
			{
				redirect(base_url('error/uagent'));
				exit(0);
			}
		}
		else
		{
			redirect(base_url('error/uagent'));
			exit(0);
		}
		
		$this->load->model('Main_model','mainmodel', TRUE);
			
		function pesan($pesan, $url)
		{
			echo "
				<script type='text/javascript'>
					alert('$pesan');
					window.location.href='$url';
				</script>
				<noscript>
					<center>
						$pesan <br />
						<a href='$url'>Lanjutkan &gt;&gt;</a>
					</center>
				</noscript>
			";
		}
		
	}
	   
	public function index()
	{
		$this->load->view('main/index');
	}
	
	public function masukan()
	{
		require "./lib/recaptcha/recaptchalib.php";
		include "./lib/src/recaptchakey.php";
		
		$nama = $this->input->post('nama');
		$email = $this->input->post('email');
		$masukan = $this->input->post('masukan');
		$alamatip = $this->input->ip_address();
		$jam = date("Y-m-d H:i:s");
		$recaptcha_challenge_field = $this->input->post('recaptcha_challenge_field');
		$recaptcha_response_field = $this->input->post('recaptcha_response_field');
		
		$resp = NULL;
		$error = NULL;
		$masuk = FALSE;
		
		if(! empty($nama) && ! empty ($email) && ! empty($masukan))
		{
			
			# was there a reCAPTCHA response?
			if ($recaptcha_response_field !== FALSE) 
			{
					$resp = recaptcha_check_answer ($privatekey,
													$_SERVER["REMOTE_ADDR"],
													$recaptcha_challenge_field,
													$recaptcha_response_field);

				if ($resp->is_valid)
				{
						$data = array('id'=>'','nama'=>$nama,'email'=>$email,'pesan'=>$masukan, 'alamatip' => $alamatip, 'jam' => $jam);
						
						$masuk = $this->mainmodel->set_masukan($data);
						
				} else {
						# set the error code so that we can display it
						pesan('Captcha tidak cocok',base_url('main/masukan.html'));
				}
			}
			else{
				pesan('Anda belum memasukan Captcha',base_url('main/masukan.html'));
			}
			
			
		}else{
			pesan('Data Tidak Lengkap',base_url('main/masukan.html'));
		}
		
		if($masuk === TRUE)
		{
			pesan('Terima kasih atas Masukan anda',base_url('main/'));
		}else{
			pesan('Gagal Input Data',base_url('main/masukan.html'));
		}
		
	}
	
	public function login()
	{
		
		include "./lib/src/skey.php";
		include "./lib/src/recaptchakey.php";
		require_once "./lib/recaptcha/recaptchalib.php";
		
		$log = FALSE;	
		
		$sc = $this->input->get('sc');
		$konten = "";
		
		switch($sc)
		{
			case "fb":
				require './lib/facebook/src/facebook.php';
				require './lib/src/fbkey.php';
				
				// Login or logout url will be needed depending on current user state.
				if ($fbuser)
				{
				  
				  $log = $this->mainmodel->get_alt_login($fbuser, 'fb');
				  
				  if($log === FALSE)
				  {
					  $konten = "
						<strong style='color:#cc0044'>Tampaknya Akun Facebook anda tidak terhubung dengan akun manapun di situs kami</strong><br /><br />
						<a href='".base_url('main/daftar.html')."'>Daftar</a> atau
						<a href='".base_url('main/login.html')."'>Login Biasa</a>
					  ";
					
				  }
				  
				} else {
				  $loginUrl = $facebook->getLoginUrl();
				  $konten = "
							<strong style='color:#cc0044'>Klik Hubungkann untuk Login lewat Facebook</strong><br /><br />
							<a href='$loginUrl' style='text-decoration:none'><img src='".base_url('images')."/facebook_icon.gif' /> Hubungkan?</a> | <a href='".base_url('main/login').".html'>Login Biasa</a>
						";
				}
				
			;
			break;
			
			case "tw":
				
				//require("./lib/twitter/twitteroauth/twitteroauth.php"); 
				
				//require './lib/src/twkey.php';
				
				
			;
			break;
			
			case "gp":
				
				require './lib/google/src/Google_Client.php';
				require './lib/google/src/contrib/Google_Oauth2Service.php';
				
				$redirect_uri = base_url('verify/login?sc=gp');
				require './lib/src/googlekey.php';
				
				if(isset($authUrl)) 
				{
					$konten = "
						<strong style='color:#cc0044'>Klik Hubungkann untuk Login lewat Akun Google</strong><br /><br />
						<a class='login' href='$authUrl' style='text-decoration:none'><img src='".base_url('images')."/gplus_icon.png' /> Hubungkan?</a> | 
						<a href='".base_url('main/login.html')."'>Login Standar</a>
					";
				} else {
					
				   $log = $this->mainmodel->get_alt_login($gpuser['id'], 'gp');
				  
				  if($log === FALSE)
				  {
					  $konten = "
						<strong style='color:#cc0044'>Tampaknya Akun Google anda tidak terhubung dengan akun manapun di situs kami</strong><br />
						<a href='".base_url('main/daftar.html')."'>Daftar</a> atau
						<a href='".base_url('main/login.html')."'>Login Standar</a>
					  ";
					  
					
				  }
				}
				  
			;
			break;
			
			default:
				
				$username = $this->input->post('username');
				$password = do_hash($this->input->post('password'));
				$recaptcha_response_field = $this->input->post('recaptcha_response_field');
				$recaptcha_challenge_field = $this->input->post('recaptcha_challenge_field');
				
				if($recaptcha_response_field != FALSE)
				{
					# was there a reCAPTCHA response?
					$resp = recaptcha_check_answer ($privatekey,
												$_SERVER["REMOTE_ADDR"],
												$recaptcha_challenge_field,
												$recaptcha_response_field);
					if ($resp->is_valid) 
					{
						$log = $this->mainmodel->get_login(array('username' => $username, 'password' => $password));
						if($log === FALSE)
						{
							$log = $this->mainmodel->get_login(array('email' => $username, 'password' => $password));
						}
					} else {
						# set the error code so that we can display it
						pesan('Captcha Tidak Cocok',base_url('main/login.html'));
					}
					
				}
				else
				{
					pesan('Anda belum memasukan captcha',base_url('main/login.html'));
				}
				
			;
			break;
		}
		
		
		
		$isipage = '
				<div id="login">
							
					<div class="space"></div>
					<div id="login2">
						<div class="title"><span style="margin-top:10px">Login</span></div>
						<div id="login3">
							
							<div class="left">&nbsp;</div>
							<div class="right">
								'.$konten.'
							</div>
							
							
							<div class="blank"></div>
							<div class="linebrown"></div>
								
								<ul>
									<li class="left">&nbsp;</li>
									<li class="right">
									<a href="'.base_url('main/lupapass.html').'">Lupa password</a> | 
									<a href="'.base_url('main/daftar.html').'">Belum Gabung?</a>
									</li>
								</ul>
							<div class="blank"></div>
							
						</div>
					</div>
					

					<div class="space"></div>

				</div>
			  ';
		
		$data['site_title'] = 'Login - Dadan Network';
		$data['base_url'] = base_url();
		$data['other_head'] = '';
		$data['tahun_sekarang'] = date("Y");
		$data['isi_page'] = $isipage;
		$this->parser->parse('template/login', $data);
		
		if($log !== FALSE)
		{
			foreach($log AS $datalogin)
			{
				$uid = $this->encrypt->encode($datalogin->uid, $skey);
				$nama = $datalogin->nama;
				$level = $this->encrypt->encode($datalogin->level, $skey);
				
				$this->input->set_cookie('dsn_pid', $uid, 10000, '', '/', '', FALSE);
				$userdata = array('uname'=>$nama,'lvl'=>$level);
				$this->session->set_userdata($userdata);
				
				if($datalogin->level == 1)
				{
					redirect(base_url('otakkanan'),'refresh');
				}
				
				if($datalogin->level == 2)
				{
					redirect(base_url('partner'),'refresh');
				}
				
			}
			pesan('kesalahan',base_url('main/login.html'));
		}else{
			if($sc !== 'fb' && $sc !== 'gp')
			{
				pesan('Kombinasi username dan password tidak Cocok',base_url('main/login.html'));
			}
		}
		
	}
	
	public function logout()
	{
			
		$skey = 'sjb8wALp4dq6OZ73Mj9bIR5Cx2vf1Khg';
		$userdata = array('uname' => '','lvl' => ($this->encrypt->encode(microtime(), $skey)));
		
		$this->session->unset_userdata($userdata);
		$this->input->set_cookie('dsn_pid', ($this->encrypt->encode(microtime(), $skey)), 8500, '', '/', '', FALSE);
		
		pesan('Anda Telah Logout',base_url('main/'));
		
	}
	
	/*
	public function daftar()
	{
		require "./lib/src/skey.php";
		
		$this->load->library('email');
		
		$nama = $this->input->post('nama');
		$email = $this->input->post('email');
		$username = $this->input->post('username');
		$password = $this->input->post('password');
		$password2 = $this->input->post('password2');
		$jk = $this->input->post('jk');
		
		
		if( ! empty ($nama) && ! empty ($email) && ! empty ($username) && ! empty ($password) && ! empty ($password2) && ! empty ($jk))
		{
			$cekusername = $this->mainmodel->cek_user_name($username);
			$cekuseremail = $this->mainmodel->get_email_user($email);
			
			if($cekusername === FALSE)
			{
				pesan('Username telah digunakan, silakan gunakan username lain.', base_url('main/daftar.html'));
				exit(0);
			}
			
			if($cekuseremail !== FALSE)
			{
				pesan('Tampaknya email yang anda gunakan sudah terdaftar. \nSilakan klik lupa password jika ingin reset password!', base_url('main/daftar.html'));
				exit(0);
			}
			
			if($password === $password2)
			{
				$tglreg = date("Y-m-d");
				$password = do_hash($password);
				$sectoken = substr(md5(microtime()),0,16);
				$sectoken2 = $this->encrypt->encode($sectoken, $skey);
				
				$data = array('uid' => '', 'username' => $username, 'password' => $password, 'nama' => $nama, 'email' => $email, 'jk' => $jk, 'tgllahir' => '0000-00-00', 'tglreg' => $tglreg, 'gambar' => '', 'sectoken' => $sectoken, 'level' => '2', 'status' => '0');
				$insert = $this->mainmodel->set_user_daftar($data);
				
				if($insert !== FALSE)
				{
					$link = base_url("verify/konfirmasi?email=$email&token=$sectoken2");
					
					$this->email->from('notifikasi@dadannetwork.com');
					$this->email->to($email);

					$this->email->subject('Konfirmasi Pendaftaran');
					$this->email->message('Selamat datang di Dadan Network\n Untuk melanjutkan pendaftaran silakan klik  <a href="'.$link.'">link berikut ini </a>. \n Jika tidak bekerja, silakan copy alamat berikut '.$link.' lalu paste di address bar pada web browser anda.  \n');	

					$this->email->send();
					
					pesan('Berhasil Melakukan Registrasi\nSilakan cek email anda untuk melanjutkan proses pendaftaran.',base_url('main/login.html'));
				}
				else
				{
					pesan('Terjadi kesalahan saat pendaftaran! silakan coba lagi!', base_url('main/daftar.html'));
					exit(0);
				}
			}
			else
			{
				pesan('Kedua password tidak cocok!', base_url('main/daftar.html'));
			exit(0);
			}
		}
		else
		{
			pesan('Semua field harus diisi!', base_url('main/daftar.html'));
			exit(0);
		} 
		
	}
	
	public function konfirmasi()
	{
		require "./lib/src/skey.php";
		
		$email = urldecode($this->input->get('email'));
		$sectoken = $this->input->get('token');
		$sectoken2 = $this->encrypt->decode($sectoken, $skey);
		
		$cekverifikasi = $this->mainmodel->cek_user_verifikasi($email);
		
		if($cekverifikasi !== FALSE)
		{
			foreach($cekverifikasi AS $hasilverifikasi)
			{
				if($hasilverifikasi->status == 0)
				{
					$verifikasi = $this->mainmodel->set_user_verifikasi($email, $sectoken2);
					
					$uid = $this->encrypt->encode($hasilverifikasi->uid, $skey);
					$nama = $hasilverifikasi->nama;
					$level = $this->encrypt->encode(2, $skey);
					
					$this->input->set_cookie('dsn_pid', $uid, 10000, '', '/', '', FALSE);
					
					$userdata = array('uname'=>$nama,'lvl'=>$level);
					$this->session->set_userdata($userdata);
				}
				else{
					pesan('User telah diverifikasi!', base_url('main/login.html'));
				}
			}
		}
		else{
			pesan('Verifikasi Gagal!', base_url('main/login.html'));
		}
		
		
	}
	
	public function resendcode()
	{
		$this->load->library('email');
		
		require_once "./lib/recaptcha/recaptchalib.php";
		include "./lib/src/recaptchakey.php";
		
		$email = $this->input->post('email');
		$recaptcha_challenge_field = $this->input->post('recaptcha_challenge_field');
		$recaptcha_response_field = $this->input->post('recaptcha_response_field');
		$resp = NULL;
		$error = NULL;
		$hasil = FALSE;
		
		
		if( ! empty($email))
		{
			
			# was there a reCAPTCHA response?
			if ($recaptcha_response_field) 
			{
					$resp = recaptcha_check_answer ($privatekey,
													$_SERVER["REMOTE_ADDR"],
													$recaptcha_challenge_field,
													$recaptcha_response_field);

				if ($resp->is_valid) {	
						
						$hasil = $this->mainmodel->cek_user_verifikasi($email);
						
				} else {
						
						pesan('Captcha tidak cocok!',base_url('main/kirimkode.html'));
						exit(0);
				}
			}
			else
			{
				pesan('Masukan Captcha!',base_url('main/kirimkode.html'));
				exit(0);
			}
			
			if($hasil !== FALSE)
			{
				foreach($hasil AS $hasil2)
				{
					if($hasil2->sectoken != NULL)
					{
						$sectoken = $hasil2->sectoken;
						$sectoken2 = $this->encrypt->encode($sectoken, $skey);
					}
					else
					{
						$sectoken = substr(md5(microtime()),0,16);
						$sectoken2 = $this->encrypt->encode($sectoken, $skey);
						$this->mainmodel->set_user_token($email, $sectoken);
					}
					
					if($hasil2->status == 0)
					{
						$link = base_url("verify/konfirmasi?email=$hasil2->email&token=$sectoken2");
					
						$this->email->from('notifikasi@dadannetwork.com');
						$this->email->to($email);

						$this->email->subject('Konfirmasi Pendaftaran');
						$this->email->message('Selamat datang di Dadan Network\n Untuk melanjutkan pendaftaran silakan klik  <a href="'.$link.'">link berikut ini </a>. \n Jika tidak bekerja, silakan copy alamat berikut '.$link.' lalu paste di address bar pada web browser anda.  \n');	

						$this->email->send();
						
						$this->load->view('main/kirimkode', array('pesan' => 'Silakan Cek email anda untuk melanjutkan!'));
					}
					else{
						pesan('User telah terverifikasi!',base_url('main/login.html'));
					}
					
					
				}
			}
			else{
				$this->load->view('main/kirimkode', array('pesan' => 'Email yang anda masukan Tidak Ditemukan!'));
			}
			
		}
		else
		{
			$this->load->view('main/kirimkode', array('pesan' => 'Masukan Email Anda!'));
		}
		
	}
	* */
	
	public function reqpass()
	{
		$this->load->library('email');
		
		$email = $this->input->post('email');
		$recaptcha_challenge_field = $this->input->post('recaptcha_challenge_field');
		$recaptcha_response_field = $this->input->post('recaptcha_response_field');
		$resp = NULL;
		$error = NULL;
		$hasil = FALSE;
			
		require_once "./lib/recaptcha/recaptchalib.php";
		require "./lib/src/recaptchakey.php";
		
		if( ! empty($email))
		{
			
			# was there a reCAPTCHA response?
			if ($recaptcha_response_field) 
			{
					$resp = recaptcha_check_answer ($privatekey,
													$_SERVER["REMOTE_ADDR"],
													$recaptcha_challenge_field,
													$recaptcha_response_field);

				if ($resp->is_valid) {	
						
						$hasil = $this->mainmodel->get_email_user($email);
						
				} else {
						# set the error code so that we can display it
						pesan('Captcha tidak cocok!',base_url('main/lupapass.html'));
						exit(0);
				}
			}
			else
			{
				pesan('Masukan Captcha!',base_url('main/lupapass.html'));
				exit(0);
			}
			
			if($hasil !== FALSE)
			{
				foreach($hasil AS $hasil2)
				{
					if($hasil2->sectoken != NULL)
					{
						$sectoken = $hasil2->sectoken;
						$sectoken2 = $this->encrypt->encode($sectoken, $skey);
					}
					else
					{
						$sectoken = substr(md5(microtime()),0,16);
						$sectoken2 = $this->encrypt->encode($sectoken, $skey);
						$this->mainmodel->set_user_token($email, $sectoken);
					}
					
					$hariini = date("d-m-Y");
					$jam = date("H:i:s");
					
					$link = base_url("verify/newpass?email=$hasil2->email&token=$sectoken2");
					
					$this->email->from('notifikasi@dadannetwork.com');
					$this->email->to($email);

					$this->email->subject('Konfirmasi Perubahan Sandi');
					$this->email->message('Anda menerima email ini karena anda atau seseorang  telah meminta perubahan pada '.$hariini.' jam '.$jam.' \n Jika itu anda silakan klik <a href="'.$link.'">link berikut ini </a>. jika tidak bekerja, silakan copy alamat berikut '.$link.' lalu paste di address bar web browser anda .  \n Jika itu bukan anda, anda dapat mengabaikan email ini. \n Salam hangat Dadan Setia');	

					$this->email->send();
					
					$this->load->view('main/lupapass', array('pesan' => 'Silakan Cek email anda. untuk konfirmasi perubahan password!'));
						
				}
			}
			else{
				$this->load->view('main/lupapass', array('pesan' => 'Email yang anda masukan Tidak Ditemukan!'));
			}
			
		}
		else
		{
			$this->load->view('main/lupapass', array('pesan' => 'Masukan Email Anda!'));
		}
	}
	
	public function newpass()
	{
		$this->load->library('email');
		
		$email = urldecode($this->input->get('email'));
		$sectoken = $this->input->get('token');
		$sectoken2 = $this->encrypt->decode($sectoken, $skey);
		
		$cuser = $this->mainmodel->get_user_data($email, $sectoken2);
		$newtoken = substr(md5(microtime()),0,16);
		$pass = substr(md5(microtime()),1,10);
		$pass2 = do_hash($pass);
		
		if($cuser !== FALSE)
		{
			foreach($cuser AS $usr)
			{
				
				$usrid = $usr->uid;
				$data = array('password' => $pass2, 'sectoken' => $newtoken);
				
				$updatepass = $this->mainmodel->set_user_password($usrid, $data);
				
				if($updatepass === TRUE)
				{
					$this->email->from('notifikasi@dadannetwork.com');
					$this->email->to($usr->email);

					$this->email->subject('Sandi telah Diubah');
					$this->email->message('Proses Perubahan Sandi Sukses. Gunakan data berikut untuk melakukan login \n Username : <b>'.$usr->username.'</b> \n Password : <b>'.$pass.'</b> \n \n Salam hangat Dadan Setia');	

					$this->email->send();
					
					pesan('Proses Reset password selesai!\nSilakan Cek email Anda!', base_url('main/login.html'));
				}
				else{
					pesan('Proses Gagal!', base_url('main/'));
				}
			}
		}
		else
		{
			pesan('Permintaan Ditolak!', base_url('main/'));
		}
	}
	
	public function updatepass()
	{
		$email = $this->input->post('email');
		$pass = $this->input->post('password');
		$pass2 = $this->input->post('password2');
		
		if($pass === $pass2)
		{
			include "./lib/src/skey.php";
			
			$password = do_hash($pass);
			$data = array('password' => $password);
			$updpass = $this->mainmodel->set_user_password($data, $email, $uid);
			if($updpass === TRUE)
			{
				$sectoken = substr(md5(microtime()),0,16);
				$this->mainmodel->set_user_token($email, $sectoken);
				pesan('Berhasil Mengubah Password', base_url('main/login.html'));
			}
			else
			{
				$this->load->view('main/newpass', array('error' => 'Perubahan Password Gagal. silakan coba lagi nanti.'));
			}
		}
		else
		{
			$this->load->view('main/newpass', array('error' => 'Kedua password tidak sama'));
		}
	}
	
	
	public function login2(){
		
		include "./lib/src/skey.php";
		
		
		$username = $this->input->post('username');
		$password = do_hash($this->input->post('password'));
		$data = array('username'=>$username, 'password'=>$password);
		
		$log = FALSE;
		$log = $this->mainmodel->get_login($data);
		
		if($log !== FALSE){
			foreach($log AS $datalogin){
				$uid = $this->encrypt->encode($datalogin->uid,$skey);
				$nama = $datalogin->nama;
				$level = $this->encrypt->encode($datalogin->level,$skey);
				
				$this->input->set_cookie('dsn_pid', $uid, 10000, '', '/', '', FALSE);
				$userdata = array('uname'=>$nama,'lvl'=>$level);
				$this->session->set_userdata($userdata);
				
				if($datalogin->level == 1){
					redirect(base_url('otakkanan'),'refresh');
				}
				
				if($datalogin->level == 2){
					redirect(base_url('partner'),'refresh');
				}
				
			}
			pesan('kesalahan',base_url('main/login.html'));
		}else{
			pesan('Kombinasi username dan password tidak Cocok',base_url('main/login.html'));
		}
		
	}
	/** tidak digunakan saat ini karena bisa ambil captcha
	**/
	
	public function lapor()
	{
		$ipclient = $this->input->ip_address();
		if ( ! $this->input->valid_ip($ipclient))
		{
			 echo '<div class"notvalid">You\'re using not valid IP. Please check your IP configuration</div>';
			 exit(0);
		}
		
		$nama = $this->input->post('nama');
		$email = $this->input->post('email');
		$alasan = $this->input->post('alasan');
		$link = $this->input->post('link');
		$jam = date("Y-m-d H:i:s");
		
		require "./lib/recaptcha/recaptchalib.php";
		require "lib/src/recaptchakey.php";
		
		$resp = null;
		$error = null;
		
		if(!empty($nama) && !empty($email) && !empty($link) && !empty($alasan)){
			
			
			# was there a reCAPTCHA response?
			if ($_POST["recaptcha_response_field"]) {
					$resp = recaptcha_check_answer ($privatekey,
													$_SERVER["REMOTE_ADDR"],
													$_POST["recaptcha_challenge_field"],
													$_POST["recaptcha_response_field"]);

				if ($resp->is_valid) {						

						$data = array('idlaporan'=>'','tautan'=>$link,'nama'=>$nama,'email'=>$email,'alasan'=>$alasan,'alamatip'=>$ipclient,'jam'=>$jam);
						
						$masuk = $this->mainmodel->setLapor($data);
						
						pesan('Terima kasih \nKami akan meninjaunya',base_url('main/'));
						
				} else {
						# set the error code so that we can display it
						pesan('Captcha tidak cocok',base_url('main'));
				}
			}
			
			
		}else{
			pesan('Data Tidak Lengkap',base_url('main'));
		}
		
	}
	
	
	
	public function kontak()
	{
		require "./lib/recaptcha/recaptchalib.php";
		require "./lib/src/recaptchakey.php";
		
		$nama = $this->input->post('nama');
		$email = $this->input->post('email');
		$masukan = $this->input->post('masukan');
		
		$recaptcha_response_field = $this->input->post('recaptcha_response_field');
		$recaptcha_challenge_field = $this->input->post('recaptcha_challenge_field');
		
		$resp = NULL;
		$error = NULL;

			
		if(! empty ($nama) && ! empty($email) && ! empty ($masukan))
		{
			
			# was there a reCAPTCHA response?
			if ($recaptcha_response_field !== FALSE) 
			{
					$resp = recaptcha_check_answer ($privatekey,
													$_SERVER["REMOTE_ADDR"],
													$recaptcha_challenge_field,
													$recaptcha_response_field);

				if ($resp->is_valid) {						

						$this->email->from('notifikasi@dadannetwork.com');
						$this->email->to('cs@dadannetwork.com');

						$this->email->subject('Kontak konsumen DadanNetwork');
						$this->email->message('Dikirim Oleh '.$nama.'('.$email.') \n'.$masukan);	

						$this->email->send();
						
						pesan('Terima kasih \nKami akan segera meninjaunya.',base_url('main/'));
						
				} else {
					
					pesan('Captcha tidak cocok!',base_url('main/kontak.html'));
					
				}
			}
			else{
				pesan('Captcha Tidak boleh kosong!',base_url('main/kontak.html'));
			}
			
			
		}else{
			pesan('Data Tidak Lengkap!',base_url('main/kontak.html'));
		}
		
	}
	
	
	
}

/* End of file verify.php */
/* Location: ./application/controllers/verify.php */
